package com.t7;

/**
 * Created by xuyiwei on 2018/7/18.
 */
class SpaceShipControls{
    void up(int velocity){}
    void dpwn(int velocity){}
    void left(int velocity){}
    void right(int velocity){}
    void forward(int velocity){}
    void back(int velocity){}
    void turboBoots(){}
}

class SpaceShip extends  SpaceShipControls{
    private String name;

    public SpaceShip(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return name;
    }

    @Override
    void up(int velocity) {
        super.up(velocity);
        System.out.println("向上看");
    }
}
public class SpaceShipDelegition {

    private String name;

    private SpaceShipControls spaceShipControls ;

    public SpaceShipDelegition(String name,SpaceShipControls spaceShipControls) {
        this.name = name;
        this.spaceShipControls =spaceShipControls;
    }



    public void up(int velocity){
        spaceShipControls.up(velocity);
    }
    public void dpwn(int velocity){
        spaceShipControls.dpwn(velocity);
    }
    public void left(int velocity){
        spaceShipControls.left(velocity);
    }
    public void right(int velocity){
        spaceShipControls.right(velocity);
    }
    public void forward(int velocity){
        spaceShipControls.forward(velocity);
    }
    public void back(int velocity){
        spaceShipControls.back(velocity);
    }
    public void turboBoots(){
        spaceShipControls.turboBoots();
    }

    public static void main(String[] args) {
        SpaceShipDelegition spaceShipDelegition = new SpaceShipDelegition("2",new SpaceShip("1"));
        spaceShipDelegition.up(111);

    }
}

